#include "../include/list.h"
#include "../3dparty/gtest-support.h"

TEST( ListTestCase, ListTest )
{
    SequenceList L;

    EXPECT_EQ( OK, SequenceListInit( &L ) );
    EXPECT_EQ( TRUE, SequenceListEmpty( &L ) );

    ElemType e = 5;
    EXPECT_EQ( OK, SequenceListInsert( &L, 1, e ) );
    e = 56;
    EXPECT_EQ( OK, SequenceListInsert( &L, 1, e ) );
    EXPECT_EQ( 2, SequenceListLength( &L ) );
    EXPECT_EQ( FALSE, SequenceListEmpty( &L ) );

    EXPECT_EQ( OK, SequenceListClear( &L ) );
    EXPECT_EQ( TRUE, SequenceListEmpty( &L ) );

	EXPECT_EQ( OK, SequenceListInsert(&L, 1, e));
	e = 100;
	EXPECT_EQ( OK, SequenceListInsert(&L, 1, e));
	EXPECT_EQ(OK, SequenceListGetElem(&L, 2, &e));
	EXPECT_EQ(56, e);

	EXPECT_EQ(0, SequenceListVisitAllElem(&L, output));

	EXPECT_EQ(OK, SequenceListDelete(&L, 1, &e));
	EXPECT_EQ(100, e);

    EXPECT_EQ( OK, SequenceListDestory( &L ) );
}